#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=16

tigrc <<EOF
set vertical-split = no
set line-graphics = ascii
EOF

steps '
	:save-display grep-scalajs.screen

	:3
	:edit

	:10
	:exec !vim +%(lineno) %(file)
'

in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"

test_tig grep JSExport

assert_equals 'grep-scalajs.screen' <<EOF
common/src/main/scala/org/scalajs/benchmark/Benchmark.scala
 13| import scala.scalajs.js.annotation.JSExport
 15| @JSExport
 27|   @JSExport
 32|   @JSExport
100|   @JSExport
deltablue/src/main/scala/org/scalajs/benchmark/deltablue/DeltaBlue.scala
 49| import scala.scalajs.js.annotation.JSExport
 51| @JSExport
 56|   @JSExport
richards/src/main/scala/org/scalajs/benchmark/richards/Richards.scala
 48| import scala.scalajs.js.annotation.JSExport
 53| @JSExport
sudoku/src/main/scala/org/scalajs/benchmark/sudoku/Sudoku.scala
[grep] common/src/main/scala/org/scalajs/benchmark/Benchmark.scala - line 1 o73%
EOF

assert_equals 'editor.log' <<EOF
+15 common/src/main/scala/org/scalajs/benchmark/Benchmark.scala
@JSExport
+56 deltablue/src/main/scala/org/scalajs/benchmark/deltablue/DeltaBlue.scala
   @JSExport
EOF
